<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
  <title>JSPWiki Test Asserted Permissions</title>
</head>
<body> 
<table cellpadding="1" cellspacing="1" border="1">
	<tbody>
	<tr><td rowspan="1" colspan="3">JSPWiki Test Asserted Permissions<br></td></tr>

	<tr><td>store</td>	<td>/@selenium.context@</td>	<td>baseUrl</td></tr>
	<tr><td>store</td>	<td>javascript{'Test-asserted-permissions-'+new Date().getTime()}</td>	<td>group</td></tr>
	<tr><td>store</td>	<td>Janne Jalkanen<br />FredFlintstone</td>		<td>members</td></tr>
	<tr><td>store</td>	<td>${baseUrl}/Wiki.jsp</td>			<td>url</td></tr>
	<tr><td>store</td>	<td>${baseUrl}/UserPreferences.jsp?redirect=Main</td>	<td>prefsurl</td></tr>
	<tr><td>store</td>	<td>${baseUrl}/Login.jsp</td>		<td>loginurl</td></tr>
	<tr><td>store</td>	<td>${baseUrl}/Group.jsp?</td>		<td>viewgroupurl</td></tr>
	<tr><td>store</td>	<td>${baseUrl}/NewGroup.jsp?</td>	<td>newgroupurl</td></tr>
	<tr><td>store</td>	<td>${baseUrl}/EditGroup.jsp?</td>	<td>editgroupurl</td></tr>
	<tr><td>store</td>	<td>janne</td>	<td>TestUsername</td></tr>
    <tr><td>store</td>	<td>myP@5sw0rd</td>	<td>TestPassword</td></tr>

    <tr><td rowspan="1" colspan="3"> Create new group with 'janne' and 'FredFlintstone' as members </td></tr>

    <tr><td>open</td>				<td>${url}</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyTitle</td>		<td>JSPWiki: Main</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyTextPresent</td>	<td>G&#8217;day (anonymous guest)</td>	<td>&nbsp;</td></tr>

    <tr><td rowspan="1" colspan="3"> login </td></tr>

    <tr><td>open</td>			<td>${loginurl}</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyTitle</td>	<td>JSPWiki: Login</td>	<td>&nbsp;</td></tr>
    <tr><td>type</td>			<td>j_username</td>		<td>${TestUsername}</td></tr>
    <tr><td>type</td>			<td>j_password</td>		<td>${TestPassword}</td></tr>
    <tr><td>clickAndWait</td>	<td>submitlogin</td>	<td>&nbsp;</td></tr>

    <tr><td>verifyTextNotPresent</td>	<td>Please sign in</td>	<td></td></tr>
    <tr><td>verifyTextPresent</td>	<td>G&#8217;day</td>	<td></td></tr>
    <tr><td>verifyTextPresent</td>	<td>(authenticated)</td>	<td></td></tr>
        
    <tr><td rowspan="1" colspan="3"> First, name the group </td></tr>

    <tr><td>open</td>					<td>${newgroupurl}</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyTitle</td>			<td>JSPWiki: New Group</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyElementPresent</td>	<td>css=form#createGroup input[name="ok"]</td>	<td></td></tr>
    <tr><td>verifyElementPresent</td>	<td>group</td>	<td></td></tr>
    <tr><td>verifyElementPresent</td>	<td>members</td>	<td></td></tr>

    <tr><td>type</td>			<td>group</td>		<td>${group}</td></tr>
    <tr><td>type</td>			<td>members</td>	<td>${members}</td></tr>
    <tr><td>clickAndWait</td>	<td>css=form#createGroup input[name="ok"]</td>	<td>&nbsp;</td></tr>
                
    <tr><td rowspan="1" colspan="3"> Verify the group was created </td></tr>

    <tr><td>verifyTextNotPresent</td>	<td>Could not create group</td>	<td></td></tr>

    <tr><td>open</td>	<td>${viewgroupurl}group=${group}</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyTitle</td>		<td>JSPWiki: ${group}</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyTextPresent</td>	<td>This is the wiki group called</td>	<td></td></tr>
        
    <tr><td rowspan="1" colspan="3"> Log out </td></tr>

    <tr><td>clickAndWait</td>	<td>link=Log out</td> 	<td>&nbsp;</td></tr>

    <tr><td rowspan="1" colspan="3"> Verifiy that anonymous users can't view the group </td></tr>

    <tr><td>open</td>	<td>${viewgroupurl}group=${group}</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyTextPresent</td>	<td>Please sign in</td>	<td></td></tr>
                
    <tr><td rowspan="1" colspan="3"> Log in again and verify we can read it </td></tr>

    <tr><td>open</td>	<td>${loginurl}</td>	<td>&nbsp;</td></tr>

    <tr><td>type</td>	<td>j_username</td>	<td>${TestUsername}</td></tr>
    <tr><td>type</td>	<td>j_password</td>	<td>${TestPassword}</td></tr>
    <tr><td>clickAndWait</td>	<td>submitlogin</td>	<td>&nbsp;</td></tr>

    <tr><td>open</td>	<td>${viewgroupurl}group=${group}</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyTextPresent</td>	<td>This is the wiki group called</td>	<td></td></tr>
                
    <tr><td rowspan="1" colspan="3"> Log out </td></tr>

    <tr><td>clickAndWait</td>	<td>link=Log out</td> 	<td>&nbsp;</td></tr>

    <tr><td rowspan="1" colspan="3"> Verify that asserted user 'Fred' can view the group but not edit </td></tr>

    <tr><td>open</td>	<td>${url}</td>	<td>&nbsp;</td></tr>
    
    <tr><td>clickAndWait</td>	<td>link=My Prefs</td> 	<td>&nbsp;</td></tr>
    <!--<tr><td>open</td>	<td>${prefsurl}</td>	<td>&nbsp;</td></tr>-->

    <tr><td>verifyTitle</td>			<td>JSPWiki: User Preferences</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyElementPresent</td>	<td>assertedName</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyElementPresent</td>	<td>css=form#setCookie input[name="ok"]</td>	<td>&nbsp;</td></tr>

    <tr><td>type</td>			<td>assertedName</td>	<td>FredFlintstone</td></tr>
    <tr><td>clickAndWait</td>	<td>css=form#setCookie input[name="ok"]</td>	<td>&nbsp;</td></tr>

    <tr><td rowspan="1" colspan="3"> Now navigate back to the main page; see the 'G'day message' for FredFlintstone </td></tr>

    <tr><td>verifyTitle</td>		<td>JSPWiki: Main</td>		<td>&nbsp;</td></tr>
    <tr><td>verifyTextPresent</td>	<td>G&#8217;day</td>		<td>&nbsp;</td></tr>
    <tr><td>verifyElementPresent</td>	<td>link=FredFlintstone</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyTextPresent</td>	<td>(not logged in)</td>	<td>&nbsp;</td></tr>

    <tr><td>assertCookie</td>	<td>regex:JSPWikiAssertedName=FredFlintstone</td>	<td></td></tr>

    <tr><td>open</td>	<td>${viewgroupurl}group=${group}</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyTitle</td>		<td>JSPWiki: ${group}</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyTextPresent</td>	<td>This is the wiki group called</td>	<td></td></tr>

    <tr><td rowspan="1" colspan="3"> Try to edit it should not be allowed </td></tr>

    <tr><td>open</td>	<td>${editgroupurl}group=${group}</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyTextPresent</td>	<td>Please sign in</td>	<td></td></tr>
        
    <tr><td rowspan="1" colspan="3"> Clear user cookie </td></tr>

    <tr><td>open</td>			<td>${prefsurl}</td>				<td>&nbsp;</td></tr>
    <tr><td>verifyTitle</td>	<td>JSPWiki: User Preferences</td>	<td>&nbsp;</td></tr>
    <tr><td>verifyValue</td>	<td>assertedName</td>				<td>FredFlintstone</td></tr>
    <tr><td>verifyElementPresent</td>	<td>css=form#clearCookie input[name="ok"]</td>	<td>&nbsp;</td></tr>
    <tr><td>clickAndWait</td>			<td>css=form#clearCookie input[name="ok"]</td>	<td>&nbsp;</td></tr>

    
	</tbody>
</table>

</body>
</html>
